package com.example.fpe_vote.db1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.fpe_vote.db1.entity.Admin;
import com.example.fpe_vote.db1.mapper.AdminMapper;
import com.example.fpe_vote.db1.service.IAdminService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2022-12-01
 */
@Service
public class AdminService extends ServiceImpl<AdminMapper, Admin> implements IAdminService {
    @Override
    public Admin queryBy(String loginName) {
        QueryWrapper<Admin> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("user_name",loginName);
        List<Admin> adminList=list(queryWrapper);
        if(adminList==null||adminList.size()==0){
            return null;
        }
        return adminList.get(0);
    }
}
